<!DOCTYPE html>
<html>
<head>
  <title></title>
</head>
<body>
<script src="https://unpkg.com/vue/dist/vue.js"></script>
<script src="https://unpkg.com/vue-router/dist/vue-router.js"></script>
<div id="app">
  <ul>
    <li><router-link to="/">Home</router-link></li>
    <li><router-link to="/about">About</router-link></li>
  </ul>
  <router-view></router-view>
</div>
<script type="text/javascript">
  let Home = { template: '<h1>This is Home!</h1>' } // Home组件
  let About = { template: '<h1>This is About!</h1>' } // About组件
  let routes = [ // 定义路由规则, 每一个路由规则应该映射一个视图组件
    { path: '/', component: Home },
    { path: '/about', component: About }
  ]
  let router = new VueRouter({ // 创建VueRouter实例, 并传入routes配置
    routes
  })
  let app = new Vue({
    router
  }).$mount('#app')
</script>
</body>
</html>